from django.db import models
from dvadmin.utils.models import CoreModel

class Budget(CoreModel):
    """预算申请模型"""
    title = models.CharField(max_length=100, verbose_name="预算标题")
    amount = models.DecimalField(max_digits=10, decimal_places=2, verbose_name="预算金额")
    department = models.CharField(max_length=100, verbose_name="申请部门")
    purpose = models.TextField(verbose_name="用途说明")
    status = models.CharField(
        max_length=20,
        choices=[
            ('pending', '待审批'),
            ('approved', '已通过'),
            ('rejected', '已拒绝')
        ],
        default='pending',
        verbose_name="审批状态"
    )
    description = models.CharField(max_length=255, null=True, blank=True, verbose_name="备注")

    class Meta:
        db_table = "finance_budget"
        verbose_name = '预算申请'
        verbose_name_plural = verbose_name
        ordering = ['-create_datetime']

class FinancialMetrics(CoreModel):
    """财务指标模型"""
    date = models.DateField(verbose_name="统计日期")
    revenue = models.DecimalField(max_digits=12, decimal_places=2, verbose_name="收入")
    costs = models.DecimalField(max_digits=12, decimal_places=2, verbose_name="成本")
    profit = models.DecimalField(max_digits=12, decimal_places=2, verbose_name="利润")
    
    class Meta:
        verbose_name = '财务指标'
        verbose_name_plural = verbose_name
        ordering = ['-date'] 